<!DOCTYPE HTML>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <meta http-equiv="Cache-Control" content="no-siteapp"/>

    <link href="/static/v5//static/h-ui/css/H-ui.min.css" rel="stylesheet" type="text/css"/>
    <link rel="stylesheet" type="text/css" href="/static/v5//static/h-ui.admin/css/H-ui.admin.css"/>
    <link rel="stylesheet" type="text/css" href="/static/v5//static/h-ui.admin/skin/default/skin.css" id="skin"/>
    <link href="/static/v5//static/h-ui.admin/css/H-ui.login.css" rel="stylesheet" type="text/css"/>
    <link href="/static/v5//static/h-ui.admin/css/style.css" rel="stylesheet" type="text/css"/>
    <link href="/static/v5//lib/Hui-iconfont/1.0.8/iconfont.css" rel="stylesheet" type="text/css"/>
    <link rel="stylesheet" type="text/css" href="/static/v5//css/kkpager_blue.css"/>
    <title></title>
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 数据管理 <span class="c-gray en">&gt;</span> 数据列表 <a
        class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px"
        href="javascript:location.replace(location.href);" title="刷新"><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">

    <th:block  th:each="funcion, funcionStat: ${funcions.obj.sonFuncion}">
        <div th:if="${funcion.func_name == '添加'}">
            <a th:href="${funcion.link_url + '?token='  + token + '&code_type=' + retInfo.obj.code_type + '&parent_id=' + retInfo.obj.parent_id}" >
                <button type="submit" class="btn btn-success radius" id="" name="">
                    <i class="Hui-iconfont">&#xe600;</i>添加
                </button>
            </a>
        </div>
    </th:block>
    <div class="mt-20">
        <table class="table table-border table-bordered table-hover table-bg table-sort">
            <thead>
            <tr class="text-c">
                <th class="head0" width="5%">Id</th>
                <th class="head0" width="5%">数值</th>
                <th class="head0" width="5%">排序</th>
                <th class="head0" width="5%">操作</th>
            </tr>
            </thead>

            <tbody>
            <th:block th:each="bean: ${retInfo.obj.list}">
                <tr class="text-c" id="table">
                    <td th:text="${bean.dict_id}"></td>
                    <td th:text="${bean.code_name}"></td>
                    <td th:text="${bean.dict_sort}"></td>
                    <td class="td-manage">
                        <th:block th:each="funcion, funcionStat: ${funcions.obj.sonFuncion}">
                            <a th:if="${funcion.func_name == '更新'}"
                               th:href="${funcion.link_url  + bean.dict_id  + '&token='  + token}">更新  </a>
                            <a th:if="${funcion.func_name == '删除'}" th:onclick="|deleteDict(this,'确定要删除吗' ,${bean.dict_id})|">删除</a>

                        </th:block>

                        <a th:if="${bean.code_type == 'city'}" th:href="${'/v5/dict/son/list?current_page=1&father_id=90&parent_id=' + bean.dict_id  + '&token='  + token}">区列表</a>


                    </td>
                </tr>
            </th:block>
            </tbody>
        </table>
    </div>
</div>
<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="/static/v5//lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="/static/v5//js/kkpager.js"></script>
<script type="text/javascript" src="/static/v5/static/h-ui/js/H-ui.min.js"></script>
<script type="text/javascript" src="/static/v5/static/h-ui.admin/js/H-ui.admin.js"></script> <!--/_footer 作为公共模版分离出去-->
<script type="text/javascript" src="/static/v5/lib/layer/2.4/layer.js"></script>
<div th:if="${retInfo.mark == '0'}">
    <div style="margin: 0px 20px 0px 20px">
        <div id="kkpager"></div>
    </div>
    <script th:inline="javascript">
        /*<![CDATA[*/
        var totalPage = [[${retInfo.obj.total_page}]];
        var totalRecords = [[${retInfo.obj.total_record}]];
        var pageNo = [[${retInfo.obj.current_page}]];
        var page_size = [[${retInfo.obj.page_size}]];
        var father_id = [[${father_id}]];
        var parent_id = [[${retInfo.obj.parent_id}]];
        /*]]>*/
        //init
        $(function () {

            if (!pageNo) {
                pageNo = 1;
            }
            //生成分页
            //有些参数是可选的，比如lang，若不传有默认值
            kkpager.generPageHtml({
                pno: pageNo,
                //总页码
                total: totalPage,
                //总数据条数
                totalRecords: totalRecords,

                getLink: function (n) {
                    var href = "/v5/dict/son/list" + "?page_size=" + page_size + "&father_id=" + father_id + "&current_page=" + n + "&token=" + sessionStorage.getItem("token")
                    +  "&parent_id=" + parent_id
                    return href;
                }

            });
        });
        var token = [[${token}]];

        function deleteDict(bj,msg ,dict_id) {
            layer.confirm(msg ,function(index){
                var data = "token=" + token + "&dict_id=" + dict_id;
                $.ajax({
                    type: 'post',
                    url: '/v5/dict/delete',
                    dataType: 'json',
                    data: data,
                    success: function (data) {
                        if (data.mark == "0") {
                            alert(data.tip);
                            window.location.reload();
                        } else {
                            alert(data.tip);
                        }
                    }
                });
            });


        }
    </script>
</div>

</body>
</html>